package com.springboot.cloud.sysadmin.organization.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.springboot.cloud.common.core.utils.StringUtils;
import com.springboot.cloud.sysadmin.organization.dao.ShuFileMapper;
import com.springboot.cloud.sysadmin.organization.entity.po.Position;
import com.springboot.cloud.sysadmin.organization.entity.po.ShuFile;
import com.springboot.cloud.sysadmin.organization.entity.po.User;
import com.springboot.cloud.sysadmin.organization.service.IShuFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Objects;

/**
 * Created by ZengJian on 2021/3/12 0012 下午 2:50
 */
@Service
@Slf4j
public class ShuFileService extends ServiceImpl<ShuFileMapper, ShuFile> implements IShuFileService {

    @Override
    public boolean add(ShuFile shuFile) {
        ShuFile shuFile1 = this.getOne(new QueryWrapper<ShuFile>().eq(StringUtils.isNotBlank(shuFile.getFileAddress()), "file_address", shuFile.getFileAddress()), false);
        if (StringUtils.isNull(shuFile1)) {
            boolean isSuccess = this.saveOrUpdate(shuFile);
            return isSuccess;
        }
        return false;
    }


}
